package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84?tpId=37&tqId=21279&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 11:06
 **/
public class PerfectNumberMain {public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    // 注意 hasNext 和 hasNextLine 的区别
    while (in.hasNextInt()) { // 注意 while 处理多个 case
        int a = in.nextInt();
        // 总的只有4个
        if(a > 10000) {
            System.out.println(4);
            continue;
        }
        int num = 0;
        for (int i = 1; i <= a; i++) {
            int sum = 0;
            for (int j = 1; j < i; j++) {
                if (i % j == 0) {
                    sum += j;
                }
            }
            if (sum == i) {
                num++;
            }
        }
        System.out.println(num);
    }
}

}
